package pack0831;
//sleep,其他阻塞
public class DemoE {
    public static void main(String[] args) {
        DemoE1 t1 = new DemoE1();
        t1.start();
        DemoE2 t2 = new DemoE2();
        t2.start();
    }
}
class DemoE1 extends Thread{
    public void run(){
        for(int i = 1; i<11; i++){
            System.out.println("aaaa");
            try {
                Thread.sleep(1000);
            }catch (Exception e){
                System.out.println(e.getMessage());
            }
        }
    }
}
class DemoE2 extends Thread{
    public void run(){
        for(int i = 1; i<11; i++){
            System.out.println("bbbb");
            try {
                Thread.sleep(1000);
            }catch (Exception e){
                System.out.println(e.getMessage());
            }
        }
    }
}